import 'package:get/get.dart';
import 'package:high_help_apps/common/apis/v1/message.dart';
import 'package:high_help_apps/common/entities/life_help/message_info_request_entity.dart';

import 'help_each_other_state.dart';

class HelpEachOtherLogic extends GetxController {
  final state = HelpEachOtherState();



  bool isInit = false;

  // 他是页面一开始加载后，会自动调用的方法
  @override
  void onReady() async {

    super.onReady();

    await firstLoadMessageInfo();

  }


  Future firstLoadMessageInfo() async {
    await loadMessageInfo();
    isInit = true;
  }

  Future loadMessageInfo() async  {

    MessageInfoRequestEntity requestEntity = MessageInfoRequestEntity().fromJson({
      'desc': '',
      'current': 1,
      'size': 20
    });

    state.messageInfoEntity = await MessageAPI.getMessageList(requestEntity);

    // 刷新组件的
    update();

  }

}
